<%@page language="Java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="includes/head.jsp" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Edit user</title>
</head>
<body>
	<f:view>
		<span id="whole-page-wrapper">
			<div id="wrapper" align="center">
			<%@include file="includes/header.jsp" %>
			<%@include file="includes/menu.jsp" %>	
					
				<div id="content">
					<div id="inner-content">
					<c:if test="${sessionScope.user.loggedUser != null }">
						<h:form> 
						<h3>Edycja użytkownika</h3><br>
							<div class="leftAlignedForm">
								<h3>Imię</h3>
								<fieldset>
									<h:inputText id="name" value="#{user.loggedUser.name}">
										<f:validator validatorId="letterValidator"/>
									</h:inputText>
									<h:message for="name"/>
								</fieldset>
								<h3>Nazwisko</h3>
								<fieldset>
									<h:inputText id="surname" value="#{user.loggedUser.surname}">
										<f:validator validatorId="letterValidator"/>
									</h:inputText>
									<h:message for="surname"/>
								</fieldset>
								<h3>Adres</h3>
								<fieldset>
									<h:inputText id="address" value="#{user.loggedUser.address}"/>
								</fieldset>
									 <br><br>
								<fieldset>
									<h:commandButton action="#{user.editUser }" value="Edytuj użytkownika" />
								</fieldset>
							</div>
						</h:form><br>
					</c:if>
					<c:if test="${sessionScope.user.loggedUser == null }">
						Nie masz uprawnień do korzystania z tej strony!
					</c:if>
					</div>
				</div>
				<%@include file="includes/footer.jsp" %>
			</div>
		</span>
	</f:view>
</body>
</html>